package edu.thu.studio.ormdesigner.model.orm.view;

import com.thoughtworks.xstream.annotations.XStreamAlias;

import edu.thu.studio.ormdesigner.model.orm.table.Table;
import edu.thu.studio.ormdesigner.util.Properties;
import edu.thu.studio.ormdesigner.util.Utils;

@XStreamAlias("view")
public class View extends Table {
    
    private static final long serialVersionUID = 6998985022414351214L;
    
    private String sql;
    
    public String getSql() {
        return sql;
    }
    
    public void setSql(String sql) {
        this.sql = sql;
    }
    
    public void checkAndInit() {
        if (null == id) {
            id = Utils.getUUID();
        }
        if (null == code) {
            code = Properties.editor_new_view_code;
        }
        if (null == name) {
            name = Properties.editor_new_view_name;
        }
    }
    
}
